//author:jxx
//此处是对表单的方法，组件，权限操作按钮等进行任意扩展(方法扩展可参照SellOrder.js)
import gridFooter from "./order/small_order_item.vue";
import gridHeader from '../proSupply/buy/buySubscribe'
import orderDetails from './order/ticketDetail'
// import RecordManually from '../../views/order/V_RecordManually.vue'
let extension = {
    components: {//动态扩充组件或组件路径
        //表单header、content、footer对应位置扩充的组件
        gridHeader:gridHeader,//{ template: "<div>扩展组xx件</div>" },
        gridBody: orderDetails,
        gridFooter: '',
        //弹出框(修改、编辑、查看)header、content、footer对应位置扩充的组件
        // modelHeader: RecordManually,
        modelBody: '',
        modelFooter: ''
    },
    buttons: {view: [
    ], box:[],  detail:[
    ]},//扩展的按钮
    methods: {//事件扩展
       onInit() {
        this.$store.getters.data().viewPageTest=this;
        this.single=true;
        this.textInline=true;
        this.ck=false;
        this.columnIndex = true;
        this.maxBtnLength = 3;
        this.boxOptions.height = 530;
        this.boxOptions.width= 900;
        this.pagination.sortName = "createDate";  //设置排序字段
       this.pagination.order = "desc" ; //排序方式desc或者asc
       //this.searchFormFields.is_pay = 3;
          this.$store.getters.data().order =this;
          this.columns.push({
            title: '操作',
            fixed: 'right',
            width: 100,
            render: (h, { row, column, index }) => {
                return h(
                    "div", { style: {} }, [
                        h(
                            "a", {
                                props: {},
                                style: {},
                                on: {
                                    click: (e) => {
                                         this.$refs.gridBody.open(row);
                                    }
                                }
                            },
                            "订单详情"
                        ),
                //      h(
                //       "a", {
                //           props: {},
                //           style: {},
                //           on: {
                //               click: (e) => {
                //                 this.$refs.gridHeader.open4(row);
                //               }
                //           }
                //       },
                //       "    操作订单"
                //   ),
                //   h(
                //     "a", {
                //         props: {},
                //         style: {},
                //         on: {
                //             click: (e) => {
                //               this.$refs.gridHeader.open8(row);
                //             }
                //         }
                //     },
                //     "    日志查看"
                // ),
                    ])
            }
        })
       },
       onInited() {
        //this.height = this.height-300;
        this.detailOptions.height = this.detailOptions.height - 200;
      },
       order(){
        //this.$refs.gridHeader.reset();
       // this.searchAfter(rows);
       console.log('头部被触发了');
       this.$refs.gridHeader.open1();
        },
        modelOpenAfter() {
          //获取当前弹出框是新建还是编辑状态
          let isEDIT = this.currentAction == this.const.EDIT;
        //  console.log(isEDIT);
          //点击弹出框后，如果是编辑状态，禁止编辑帐号，如果新建状态，将帐号字段设置为可编辑
          this.editFormOptions.forEach(item => {
              item.forEach(x => {
                      //如果是编辑帐号设置为只读
                      if (x.field == "order_number") {
                          //disabled是editFormOptions的动态属性，这里只能通过this.$set修改值
                          this.$set(x, "disabled", true)
                      }
                      if (x.field == "ticketsCode") {
                          //disabled是editFormOptions的动态属性，这里只能通过this.$set修改值
                          this.$set(x, "disabled", true)
                      }
                      if (x.field == "bookingName") {
                        //disabled是editFormOptions的动态属性，这里只能通过this.$set修改值
                        this.$set(x, "disabled", true)
                    }
                      if (x.field == "type") {
                        //disabled是editFormOptions的动态属性，这里只能通过this.$set修改值
                        this.$set(x, "disabled", true)
                    }
                      if (x.field == "status") {
                        //disabled是editFormOptions的动态属性，这里只能通过this.$set修改值
                        this.$set(x, "disabled", true)
                    }
                    if (x.field == "bookingPhone") {
                      //disabled是editFormOptions的动态属性，这里只能通过this.$set修改值
                      this.$set(x, "disabled", true)
                  }
                  })
          })
      },
      rowClick({ row, column, event }) { //查询界面table点击行选中当前行
        return true;
       },
       searchAfter(rows) {
        //页面加载或者刷新数据后直接显示第一行的明细
        // if (rows.length) {
        //   let where = {
        //     sort:"id",
        //     value:rows[0].id
        // };
        //   this.$refs.gridFooter.$refs.tableList.load(where)
        //  }else{
        //   //没有数据时，清空明细数据
        //   this.$refs.gridFooter.$refs.tableList.reset()
        // }
        return true;
      },
    }
};
export default extension;
